#!/bin/sh
set -e
if [ "$WEB_ROOT" ];
    then
    sed -i "s|WEB_ROOT|$WEB_ROOT|g" /usr/share/nginx/html/dist/main.*.js
fi
if [ "$APP_ROOT" ];
    then
    sed -i "s|APP_ROOT|$APP_ROOT|g" /usr/share/nginx/html/dist/main.*.js
fi
if [ "$SOCKET_URL" ];
    then
    sed -i "s|SOCKET_URL|$SOCKET_URL|g" /usr/share/nginx/html/dist/main.*.js
fi
if [ "$UPLOAD_URL" ];
    then
    sed -i "s|UPLOAD_URL|$UPLOAD_URL|g" /usr/share/nginx/html/dist/main.*.js
fi
nginx -g 'daemon off;'